﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.FarmCommand;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.FarmHandler
{
    public class UpdHygieneCommandHandler : IRequestHandler<UpdHygieneCommand, int>
    {
        /// <summary>
        /// 养殖服务层
        /// </summary>
        IFarmService FarmS;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="FarmS">养殖服务层</param>
        public UpdHygieneCommandHandler(IFarmService FarmS)
        {
            this.FarmS = FarmS;
        }

        public async Task<int> Handle(UpdHygieneCommand request, CancellationToken cancellationToken)
        {
            return await FarmS.UpdHygiene(new Entity.Traceability.Hygiene() { Hygieneid = request.Hygieneid, Feedingdays = request.Feedingdays, Delivery = request.Delivery, CareMethod = request.CareMethod, LOT = request.LOT, Uid = request.Uid,UpdName = request.UpdName, UpdTime = request.UpdTime});
        }
    }
}
